package it.com.chen.movieReleasesDB;

public class CalendarMonthManager {

	public static int convertMonth(String month) {
		String[] monthNumberAssociationList = new String[12];

		monthNumberAssociationList[0] = "january";
		monthNumberAssociationList[1] = "february";
		monthNumberAssociationList[2] = "march";
		monthNumberAssociationList[3] = "april";
		monthNumberAssociationList[4] = "may";
		monthNumberAssociationList[5] = "june";
		monthNumberAssociationList[6] = "july";
		monthNumberAssociationList[7] = "august";
		monthNumberAssociationList[8] = "september";
		monthNumberAssociationList[9] = "october";
		monthNumberAssociationList[10] = "november";
		monthNumberAssociationList[11] = "december";

		for (int i = 0; i < monthNumberAssociationList.length; i++) {
			if (monthNumberAssociationList[i].equals(month)) {
				return i;
			}
		}
		return 0;
	}
	
	public static String convertMonth(int month) {
		String[] monthNumberAssociationList = new String[12];

		monthNumberAssociationList[0] = "january";
		monthNumberAssociationList[1] = "february";
		monthNumberAssociationList[2] = "march";
		monthNumberAssociationList[3] = "april";
		monthNumberAssociationList[4] = "may";
		monthNumberAssociationList[5] = "june";
		monthNumberAssociationList[6] = "july";
		monthNumberAssociationList[7] = "august";
		monthNumberAssociationList[8] = "september";
		monthNumberAssociationList[9] = "october";
		monthNumberAssociationList[10] = "november";
		monthNumberAssociationList[11] = "december";

		return monthNumberAssociationList[month];
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(convertMonth("september"));
		System.out.println(convertMonth(8));
	}

}
